package com.rw;

import com.rw.factory.TestActiveFactory;
import com.rw.pojo.FatherTest;
import com.rw.pojo.TestSubA;
import jdk.management.resource.internal.inst.SocketOutputStreamRMHooks;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class IOCCreateTest {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationcontext.xml");
        System.out.println("--------------------");
        FatherTest f = (FatherTest) ac.getBean("test");
       f.test();
        System.out.println("空参构造函数f=" +f);
        FatherTest f1 = (FatherTest) ac.getBean("testA");
        System.out.println("带参构造函数f1=" +f1);
        FatherTest f2 = (FatherTest) ac.getBean("testB");
        System.out.println("通过属性注入的对象f2=" +f2);
//        FatherTest f3 = (FatherTest) ac.getBean("testC");
//        System.out.println("静态工厂的对象f3=" +f3);
//
//        FatherTest f4 = (FatherTest) ac.getBean("testD");
//        System.out.println("动态态工厂的对象f4=" +f4);
    }
}
